import time

from selenium import webdriver


def cooke():
    driver = webdriver.Chrome(r"C:\Users\10447\PycharmProjects\demo_selenium1\chromedriver.exe")
    driver.get("http://192.168.195.148/bmsa/#/login?returnUrl=%2Fperfinsights%2F")
    driver.implicitly_wait(5)
    driver.maximize_window()
    el1 = driver.find_element_by_xpath(".//input[@placeholder='账号']")
    el1.send_keys('root')
    el2 = driver.find_element_by_xpath(".//input[@placeholder='密码' and @autocomplete='off' and @type='password']")
    el2.send_keys('123')
    el3 = driver.find_element_by_xpath(".//input[@placeholder='验证码']")
    el3.send_keys('8888')
    el4 = driver.find_element_by_xpath(".//button[@class='el-button submit_btn el-button--primary']")
    el4.click()
    time.sleep(1)
    res1 = driver.get_cookies()[0]['value']
    return res1

cooke()